/*
 * Copyright © 2017 Cask Data, Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */
@import '../../../styles/variables.scss';

$cdap_mode_color: #cccccc;

.product-dropdown {
  display: inline-block;
  background: transparent;

  @media (max-width: 580px) {
    &.dropdown {
      &.open {
        .dropdown-menu {
          &.dropdown-menu-right {
            left: 0;
            right: auto;
          }
        }
      }
    }
  }
  &:hover {
    background: transparent;
  }

  .btn.btn-secondary {
    background: transparent;
    border: 0;
    &:focus {
      color: $cdap-light-orange;
    }
  }
  &.dropdown,
  &.dropdown.open {
    &:focus {
      outline: none;
    }
  }
  &.dropdown {
    .dropdown-toggle {
      background: transparent;
      border: 0;
      vertical-align: top;
      height: 50px;
      padding: 0;
      position: relative;
      width: 120px;
      color: inherit;
      margin-right: 5px;
      display: inline-flex;
      flex-direction: column;
      line-height: 1;
      justify-content: center;
      padding-top: 4px;
      text-align: left;

      &:hover,
      &:focus {
        background: transparent;
        outline: none;
        .cdap-secure-mode-icon {
          color: $cdap_mode_color;
        }
      }
      &:after {
        display: none;
      }
      .cdap-logo-container {
        position: relative;
        width: inherit;
      }
      .caret-down-container {
        display: inline-block;
        position: absolute;
        right: 3px;
        top: 7px;
      }
      .cdap-logo {
        display: inline-block;
        img {
          height: 14px;
          width: 70px;
        }
      }
      .cdap-mode {
        font-size: 10px;
        font-weight: 500;
        color: $cdap_mode_color;
        line-height: 1;
        display: inline-block;
        margin-right: 5px;
        vertical-align: bottom;
      }
      .secure-mode-icon {
        display: inline-block;
        line-height: 1;
        font-size: 10px;
        color: $cdap_mode_color;
        padding-top: 5px;
      }
    }
    .dropdown-menu {
      border-radius: 0;
      background: #333333;
      color: white;
      min-width: 160px;
      max-width: 210px;

      .dropdown-item,
      .dropdown-header {
        color: inherit;
        line-height: 1;
        min-width: inherit;
        max-width: inherit;
        padding: 0;
        margin-left: 0;
        float: left;

        &:hover,
        &:focus {
          background: transparent;
        }
        a {
          text-decoration: none;
          padding: 10px 16px;
          background: transparent;

          &:hover {
            color: $cdap-light-orange;
          }
        }
      }

      .user-profile {
        min-width: inherit;
        max-width: inherit;
        margin-left: 0;

        > {
          :not(:first-child) {
            cursor: pointer;
          }
        }

        .user-section {
          span {
            color: rgba(255, 205, 128, 1);
          }
          .user-name {
            font-size: 13px;
            text-overflow: ellipsis;
            max-width: inherit;
            width: calc(100% - 10px - 23px);
            overflow: hidden;
            white-space: nowrap;
            display: inline-block;
          }
          .user-icon-container {
            border: 1px solid rgba(255, 205, 128, 1);
            border-radius: 50%;
            padding: 5px 5px;
            background: rgba(255, 205, 128, 1);
            margin-right: 8px;
            color: $navbar-bg;
            display: inline-flex;
          }
        }
      }
      .dropdown-divider {
        background-color: rgba(75, 75, 75, 1);
      }
    }
    &.open {
      .dropdown-menu {
        display: flex;
        flex-direction: column;
      }
    }
  }
}
